Developer Documentation

QuickTime 4 API Documentation

QuickTime Movie File Format Specification, May 1996

| Previous | Chapter contents | Chapter top | Next |

Creating a Time Code Track for 29.97 FPS Video

A time code track specifies time code information for other tracks. The time code keeps track of the time codes of the original source of the video and audio. After a movie has been edited, the time code can be extracted to determine the source tape and the time codes of the frames.

It is important that the time code track has the same time scale as the video track. Otherwise, the time code will not tick at the exact same time as the video track.

For each contiguous source tape segment, there is a single time code sample that specifies the time code value corresponding to the start of the segment. From this sample, the time code value can be determined for any point in the segment.

The sample description for a time code track specifies the time code system being used (for example, 30 fps drop-frame) and the source information. Each sample is a time code value.

Since the time code media handler is a derived from the base media handler, the media information atom starts with a generic media header atom. The time code atoms would contain the following data values:

Atom size

77

 

 

Atom type

'gmhd'

 

 

 

Atom size

69

 

 

Atom type

'gmin'

 

 

Version/Flags

0

 

 

Graphics mode

0x0040

 

 

Opcolor (red)

0x8000

 

 

Opcolor (green)

0x8000

 

 

Opcolor (blue)

0x8000

 

 

Balance

0

 

 

Reserved

0

 

 

Atom size

45

 

 

Atom type

'tmcd'

 

 

 

Atom size

37

 

 

Atom type

'tcmi'

 

 

Version/Flags

0

 

 

Text font

0 (system font)

 

 

Text face

0 (plain)

 

 

Text size

12

 

 

Text color (red)

0

 

 

Text color (green)

0

 

 

Text color (blue)

0

 

 

Background color (red)

0

 

 

Background color (green)

0

 

 

Background color (blue)

0

 

 

Font name

"\pChicago" (Pascal string)

The sample table atom contains all the standard sample atoms and has the following data values:

Atom size

174

 

 

Atom type

'stbl' (sample table)

 

 

 

Atom size

74

 

 

Atom type

'stsd' (sample description)

 

 

Version/Flags

0

 

 

Number of entries

1

 

 

Sample description size [1]

58

 

 

Data format [1]

'tmcd'

 

 

Reserved [1]

0

 

 

Data reference index [1]

1

 

 

Flags [1]

0

 

 

Flags (time code) [1]

7 (drop frame + 24 hour + negative times ok)

 

 

Time scale[1]

2997

 

 

Frame duration[1]

100

 

 

Number of frames[1]

20

 

 

 

Atom size

24

 

 

Atom type

'name'

 

 

String length

12

 

 

Language code

0 (English)

 

 

Name

"my tape name"

 

Atom size

24

 

 

Atom type

'stts' (time-to-sample)

 

 

Version/Flags

0

 

 

Number of entries

1

 

 

Sample count[1]

1

 

 

Sample duration[1]

1

 

 

Atom size

28

 

 

Atom type

'stsc' (sample-to- chunk)

 

 

Version/Flags

0

 

 

Number of entries

1

 

 

First chunk[1]

1

 

 

Samples per chunk[1]

1

 

 

Sample description ID[1]

1

 

 

Atom size

20

 

 

Atom type

'stsz' (sample size)

 

 

Version/Flags

0

 

 

Sample size

4

 

 

Number of entries

1

 

 

Atom size

20

 

 

Atom type

'stco' (chunk offset)

 

 

Version/Flags

0

 

 

Number of entries

1

 

 

Offset[1]

(offset into file of chunk 1)

 

In the example, let's assume that the segment's beginning time code is 1:15:32.4 (1 hour, 15 minutes, 32 seconds, and 4 frames). This time would be expressed in the data file as 0x010F2004 (0x01 = 1 hour; 0x0F = 15 minutes; 0x20 = 32 seconds; 0x04 = 4 frames).

The video and audio tracks must contain a track reference atom to indicate that they reference this time code track. The track reference is the same for both and is contained in the track atom (at the same level as the track header and media atoms).

This track reference would contain the following data values:

Atom size

12

Atom type

'tref'

Reference type

'tmcd'

Track ID of referenced track (time code track)

3

In this example, the video and sound tracks are tracks 1 and 2. The time code track is track 3.


© 1997 Apple Computer, Inc.

| Previous | Chapter contents | Chapter top | Next |